/**
 * @Auther: ayo
 * @Date: 2021/02/28 13:10
 * @Description: // TODO
 */
import { Injectable } from '@angular/core';
import { environment } from '@env/environment';

@Injectable()
export class NetworkConfig {

    static BASIC_CONFIGS: any = {
        HOST: location.protocol + '//' + location.host + '',
        SYSTEM_CODE: '',
        WEIBO_CLIENT_ID: 0,
        WEIBO_CALLBACK: '',
        DEFAULT_AVATAR: './assets/avatar.png',
        ITEM_PER_ROW: 3,
        TABLE_LAYOUT_WHOLE: {
            lg: 8, md: 8, sm: 24
        },
        ST_SIZE: 'small',
        PAGE_INDEX: 1,
        PAGE_SIZES: 10,
        PAGE_SHOW_SIZE_LIST: true,
        PAGE_SIZE_LIST: [10, 20, 30, 50],
        DIALOG_LAYOUT_WHOLE: {
            lg: 8, md: 8, sm: 24
        },
        DIALOG_WIDTH_MAX: '960px',
        DIALOG_MASK_CLOSABLE: true,
        YEAR_DATE_FORMAT: 'yyyy-MM-dd',
        YEAR_TIME_DATE_FORMAT: 'YYYY-MM-DD HH:mm',
        TIME_FORMAT: 'HH:mm',
        RANGE_YEAR_TIME_FORMAT: [
            'yyyy-MM-dd HH:mm',
            { nzFormat: 'HH:mm' }
        ],
        GENDERS: [{ value: 0, text: '女' }, { value: 1, text: '男' }],
        MODULE_URL: 'Api',
        AES_KEY: 'yitongmedphsp123'
    };

    static ENV: any = {
        host: {
            domain: ''
        }, headers: {
            // 'Access-Control-Allow-Origin': '*',
            // 'accessToken': '',
            // 'X-Authorization': '',
            // 'Content-Type': 'application/json;charset=UTF-8',
            // 'Accept': 'application/json;charset=UTF-8',
            // 'Pragma': 'no-cache',
            // 'Cache-Control': 'no-cache'
        }
    };

    static URLs = {
        LOGIN: `um${NetworkConfig.BASIC_CONFIGS.MODULE_URL}/v1/um/login`
    };

    static BaseConfig = {
        actLogin: /^\w{5,50}$/,
        actPwd: /^(?!([a-z]*|[A-Z]*|[0-9]*|[\\p{Punct}]*|[a-zA-Z]*|[a-z0-9]*|[a-z\\p{Punct}]*|[A-Z0-9]*|[A-Z\\p{Punct}]*|[0-9\\p{Punct}]*)$)[a-zA-Z0-9\\p{Punct}]{8,20}$/,
        phone: /^1\d{10}$/,
        telephone: /^([0-9]|[-])+$/g,
        email: /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/,
        identity: /(^\d{15}$)|(^\d{17}([0-9]|X|x)$)/, // 身份证
        interimIdentity: /(^\d{15}$)|(^\d{17}([0-9]|X|x)$)/, // 临时身份证
        hkMacao: /(^((81|82)0000)\d{11}(\d|X|x)$)|(^((81|82)0000)\d{12}$)/, // 港澳居民居住证
        Taiwan: /(^(830000)\d{11}(\d|X|x)$)|(^(830000)\d{12}$)/, // 台湾居民居住证
        dialogWidthMin: '650px',
        dialogWidthMid: '',
        dialogWidthMax: '920px',
        patternTwenty: /^.{1,20}$/,
        patternHundred: /^.{1,100}$/,
        isNumber: /^\d+$/,
        isCircleDay: /^\d{0,5}$/,
        imageFileSize: 10240,
        fileSize: 10240,
        imageFileType: 'image/png,image/PNG,image/jpg,image/jpeg,image/JPG,image/JPEG,image/gif,image/GIF,image/bmp,image/BMP,image/heic,image/HEIC',
        pageSizeList: [10, 20, 30, 50],
        fileFileType: 'image/png,image/PNG,image/jpg,image/jpeg,image/JPG,image/JPEG,image/gif,image/GIF,image/bmp,image/BMP,image/heic,image/HEIC,application/pdf,application/PDF',
    };

    static MENU_MAPPING: any = [{
        text: '主菜单', group: true, autoCloseUnderPad: true, children: [{
            //     text: '仪表盘', link: '/dashboard', icon: { type: 'icon', value: 'dashboard' }, children: [{
            //         'text': '工作台', 'link': '/dashboard/workplace'
            //     }, {
            //         'text': '监控页', 'link': '/dashboard/monitor'
            //     }]
            // }, {
            text: '工作台', resourceCode: 'MEMU_WORKPLAT', link: '/dashboard/workspace', icon: { type: 'icon', value: 'dashboard' }
        }, {
            text: '系统管理', resourceCode: 'MENU_SYSTEM_MANAGE', group: true, icon: { type: 'icon', value: 'appstore' }, children: [{
                text: '机构信息', resourceCode: 'MENU_TEANANT', link: '/institutional-information'
            }, {
                text: '用户管理', resourceCode: 'MENU_ACCOUNT', link: '/user-management'
            }, {
                text: '权限管理', resourceCode: 'MENU_PERMISSION', link: '/privilege-management'
            }, {
                text: '组织管理', resourceCode: 'MENU_ORGANIZATION', link: '/organization-management'
            }]
        }, {
            text: '标签管理', resourceCode: 'MENU_TAG', link: '/label-management', icon: { type: 'icon', value: 'tags' }
        }, {
            text: '统计报表', resourceCode: 'MENU_STATISTICS', link: '/data-analysis', icon: { type: 'icon', value: 'line-chart' }
        }, {
            text: '数据模板', resourceCode: 'MENU_DATA_TEMPLET', link: '/data-template', icon: { type: 'icon', value: 'profile' }
            // }, {
            //     text: '微信服务管理', resourceCode: '', link: '/weChat-service', icon: { type: 'icon', value: 'appstore' }
        }, {
            text: '健康方案', resourceCode: 'MENU_SOLUTION', link: '/health-program', icon: { type: 'icon', value: 'project' }
            // }, {
            //     text: '微信推送管理', resourceCode: '', link: '/weChat-push', icon: { type: 'icon', value: 'appstore' }
            // }, {
            //     text: '客户管理', resourceCode: 'MENU_CUSTOMER', group: true, icon: { type: 'icon', value: 'idcard' }, children: [{
            //         text: '企业客户', resourceCode: 'MENU_CUSTOMER_COMPANY', link: '/customer-management/enterprise-customers'
            //     }, {
            //         text: '个人客户', resourceCode: 'MENU_CUSTOMER_PERSONAL', link: '/customer-management/individual-customers'
            //     }]
        }, {
            text: '客户管理',
            resourceCode: 'MENU_CUSTOMER',
            link: '/customer-management/individual-customers',
            icon: { type: 'icon', value: 'idcard' }
        }, {
            text: '档案关联', resourceCode: 'MENU_CUSTOMER_MERGE', link: '/customer-file-management', icon: { type: 'icon', value: 'branches' }
        }, {
            text: '客户画像', resourceCode: 'MENU_CUSTOMER_CHARACTERISTIC', group: true, icon: { type: 'icon', value: 'appstore' }, children: [{
                text: '群体画像分析', resourceCode: 'MENU_CUSTOMER_GROUP_PERSONAS', link: '/customer-group-personal'
            }, {
                text: '客户分群', resourceCode: 'MENU_CUSTOMER_CLUSTER', link: '/customer-cluster'
            }]
        }, {
            text: '客户群画像',
            resourceCode: 'MENU_CUSTOMER_GROUP_PERSONAS',
            link: '/customer-group-personal',
            icon: { type: 'icon', value: 'branches' }
        }, {
            text: '健康教育', resourceCode: 'MENU_HEALTH_EDU', group: true, icon: { type: 'icon', value: 'read' }, children: [{
                text: '文章管理', resourceCode: 'MENU_ARTICLE_MANAGEMENT', link: '/health-education/article-management'
            },
                //     {
                //     text: '分类管理', resourceCode: 'MENU_ARTICLE_CATEGORY', link: '/health-education/article-category'
                // },
                {
                    text: '文章推送', resourceCode: 'MENU_ARTICLE_PUSH', link: '/health-education/article-push'
                },
                {
                    text: '文章审核', resourceCode: 'MENU_CMS_EXAME', link: '/health-education/cms-exame'
                }]
            // }, {
            //     text: '咨询管理', resourceCode: '', link: '/consultation-management', icon: { type: 'icon', value: 'appstore' }
            // }, {
            //     text: '商城管理', resourceCode: '', link: '/mall-management', icon: { type: 'icon', value: 'appstore' }
            // }, {
            //     text: '消息管理', resourceCode: '', link: '/message-management', icon: { type: 'icon', value: 'appstore' }
            // }, {
            //     text: '任务管理', resourceCode: '', link: '/task-management', icon: { type: 'icon', value: 'appstore' }
        },
            {
                text: '外置界面',
                resourceCode: 'MENU_EXPORT',
                group: true,
                hideInBreadcrumb: true,
                hide: true,
                icon: { type: 'icon', value: 'idcard' },
                link: '/fullscreen/export',
                reuse: false
                // children: [
                //     {
                //         text: 'Relation',
                //         i18n: 'Relation',
                //         link: '/fullscreen/customer-management/individual-customers',
                //         reuse: false
                //     }
                // ]
            }
            // , {
            //     text: '患者管理', link: '/patient-administration', icon: { type: 'icon', value: 'contacts' }
            // }
        ]
    }];

    static successCode = '0';
    static errorCode = '1';

    // const temp = [{
    //     lookupCode: 'group', description: '组名(组)', subDescription: '其他描述', items: [{
    //         lookupCode: '需要映射的字段code',
    //         title: '标题',
    //         subTitle: '副标题',
    //         inputType: '类型',
    //         modelName: '值',
    //         options: '值列表',
    //         placeholder: '占位符',
    //         length: { maxLength: '长度限制', minLength: '长度限制' },
    //         pattern: '正则校验',
    //         disabled: '是否允许点击',
    //         required: '是否必填项',
    //         checkTexts: {
    //             isEmptyText: '为空时提示信息', patternText: '校验错误时提示信息', otherText: '其他提示信息'
    //         },
    //         icon: '图标',
    //         layout: {
    //             lg: '布局', md: '布局', sm: '布局'
    //         }
    //     }, {
    //         lookupCode: '需要映射的字段code',
    //         title: '静态',
    //         subTitle: null,
    //         inputType: 'label',
    //         modelName: null,
    //         options: null,
    //         placeholder: null,
    //         length: { maxLength: null, minLength: null },
    //         pattern: null,
    //         disabled: null,
    //         required: null,
    //         checkTexts: {
    //             isEmptyText: null, patternText: null, otherText: null
    //         },
    //         icon: null,
    //         layout: {
    //             lg: 12, md: 12, sm: 24
    //         }
    //     }, {
    //         lookupCode: '需要映射的字段',
    //         title: '单行文本',
    //         subTitle: null,
    //         inputType: 'text',
    //         modelName: null,
    //         options: null,
    //         placeholder: '请填写',
    //         length: { maxLength: 20, minLength: 4 },
    //         pattern: null,
    //         disabled: false,
    //         required: true,
    //         checkTexts: {
    //             isEmptyText: '请填写XX', patternText: 'XX输入错误', otherText: '其他提示信息'
    //         },
    //         icon: null,
    //         layout: {
    //             lg: 12, md: 12, sm: 24
    //         }
    //     }, {
    //         lookupCode: '需要映射的字段',
    //         title: '多行文本',
    //         subTitle: null,
    //         inputType: 'textarea',
    //         modelName: null,
    //         options: null,
    //         placeholder: '请填写',
    //         length: { maxLength: 200, minLength: 0 },
    //         pattern: null,
    //         disabled: false,
    //         required: true,
    //         checkTexts: {
    //             isEmptyText: '请填写标签名称', patternText: 'XX输入错误', otherText: null
    //         },
    //         icon: null,
    //         layout: {
    //             lg: 12, md: 12, sm: 24
    //         }
    //     }, {
    //         lookupCode: '需要映射的字段',
    //         title: '单选',
    //         subTitle: null,
    //         inputType: 'radio',
    //         modelName: null,
    //         options: [{ lookupValue: '男', lookupCode: 1 }, { lookupValue: '女', lookupCode: 0 }],
    //         placeholder: null,
    //         length: { maxLength: null, minLength: null },
    //         pattern: null,
    //         disabled: false,
    //         required: true,
    //         checkTexts: {
    //             isEmptyText: '请选择', patternText: null, otherText: null
    //         },
    //         icon: null,
    //         layout: {
    //             lg: 12, md: 12, sm: 24
    //         }
    //     }, {
    //         lookupCode: '需要映射的字段',
    //         title: '多选',
    //         subTitle: null,
    //         inputType: 'checkbox',
    //         modelName: null,
    //         options: [{ lookupValue: '男', lookupCode: 1 }, { lookupValue: '女', lookupCode: 0 }],
    //         placeholder: null,
    //         length: { maxLength: null, minLength: null },
    //         pattern: null,
    //         disabled: false,
    //         required: true,
    //         checkTexts: {
    //             isEmptyText: '请选择', patternText: null, otherText: null
    //         },
    //         icon: null,
    //         layout: {
    //             lg: 12, md: 12, sm: 24
    //         }
    //     }, {
    //         lookupCode: '需要映射的字段',
    //         title: '单选弹出',
    //         subTitle: null,
    //         inputType: 'select',
    //         modelName: null,
    //         options: [{ lookupValue: '男', lookupCode: 1 }, { lookupValue: '女', lookupCode: 0 }],
    //         placeholder: '请选择',
    //         length: { maxLength: null, minLength: null },
    //         pattern: null,
    //         disabled: false,
    //         required: true,
    //         checkTexts: {
    //             isEmptyText: '请选择XX', patternText: null, otherText: null
    //         },
    //         icon: null,
    //         layout: {
    //             lg: 12, md: 12, sm: 24
    //         }
    //     }, {
    //         lookupCode: '需要映射的字段',
    //         title: '多选弹出',
    //         subTitle: null,
    //         inputType: 'select-tag',
    //         modelName: null,
    //         options: null,
    //         placeholder: '请选择',
    //         length: { maxLength: 5, minLength: 1 },
    //         pattern: null,
    //         disabled: false,
    //         required: true,
    //         checkTexts: {
    //             isEmptyText: '请选择XX', patternText: '', otherText: null
    //         },
    //         icon: null,
    //         layout: {
    //             lg: 12, md: 12, sm: 24
    //         }
    //     }, {
    //         lookupCode: '需要映射的字段',
    //         title: '日期',
    //         subTitle: null,
    //         inputType: 'date',
    //         modelName: 1554616800000,
    //         options: null,
    //         placeholder: null,
    //         length: { maxLength: 155461680000, minLength: 155461680001 },
    //         pattern: null,
    //         disabled: true,
    //         required: true,
    //         checkTexts: {
    //             isEmptyText: '请选择XX', patternText: null, otherText: null
    //         },
    //         icon: null,
    //         layout: {
    //             lg: 12, md: 12, sm: 24
    //         }
    //     }, {
    //         lookupCode: '需要映射的字段',
    //         title: '时间',
    //         subTitle: null,
    //         inputType: 'datetime',
    //         modelName: null,
    //         options: null,
    //         placeholder: '请选择',
    //         length: { maxLength: 155461680000, minLength: 155461680001 },
    //         pattern: null,
    //         disabled: true,
    //         required: true,
    //         checkTexts: {
    //             isEmptyText: '请选择XX', patternText: null, otherText: null
    //         },
    //         icon: null,
    //         layout: {
    //             lg: 12, md: 12, sm: 24
    //         }
    //     }, {
    //         lookupCode: '需要映射的字段',
    //         title: '图片',
    //         subTitle: null,
    //         inputType: 'image',
    //         modelName: null,
    //         options: null,
    //         placeholder: '请选择',
    //         length: { maxLength: 9, minLength: 0 },
    //         pattern: null,
    //         disabled: false,
    //         required: true,
    //         checkTexts: {
    //             isEmptyText: '请选择XX', patternText: null, otherText: null
    //         },
    //         icon: null,
    //         layout: {
    //             lg: 12, md: 12, sm: 24
    //         }
    //     }], iconUrlGroups: null, skipGroups: null, buttonGroups: null
    // }];
    //
    // const parentTemp = [{
    //     lookupCode: 'titleCode', description: '标题', subDescription: '副标题', items: [{
    //         lookupCode: 'group', description: '组名(组)', subDescription: '其他描述', items: [{
    //             lookupCode: '需要映射的字段code',
    //             title: '标题',
    //             subTitle: '副标题',
    //             inputType: '类型',
    //             modelName: '值',
    //             options: '值列表',
    //             placeholder: '占位符',
    //             length: { maxLength: '长度限制', minLength: '长度限制' },
    //             pattern: '正则校验',
    //             disabled: '是否允许点击',
    //             required: '是否必填项',
    //             checkTexts: {
    //                 isEmptyText: '为空时提示信息', patternText: '校验错误时提示信息', otherText: '其他提示信息'
    //             },
    //             icon: '图标',
    //             layout: {
    //                 lg: '布局', md: '布局', sm: '布局'
    //             }
    //         }, {
    //             lookupCode: '需要映射的字段code',
    //             title: '静态',
    //             subTitle: null,
    //             inputType: 'label',
    //             modelName: null,
    //             options: null,
    //             placeholder: null,
    //             length: { maxLength: null, minLength: null },
    //             pattern: null,
    //             disabled: null,
    //             required: null,
    //             checkTexts: {
    //                 isEmptyText: null, patternText: null, otherText: null
    //             },
    //             icon: null,
    //             layout: {
    //                 lg: 12, md: 12, sm: 24
    //             }
    //         }, {
    //             lookupCode: '需要映射的字段',
    //             title: '单行文本',
    //             subTitle: null,
    //             inputType: 'text',
    //             modelName: null,
    //             options: null,
    //             placeholder: '请填写',
    //             length: { maxLength: 20, minLength: 4 },
    //             pattern: null,
    //             disabled: false,
    //             required: true,
    //             checkTexts: {
    //                 isEmptyText: '请填写XX', patternText: 'XX输入错误', otherText: '其他提示信息'
    //             },
    //             icon: null,
    //             layout: {
    //                 lg: 12, md: 12, sm: 24
    //             }
    //         }, {
    //             lookupCode: '需要映射的字段',
    //             title: '多行文本',
    //             subTitle: null,
    //             inputType: 'textarea',
    //             modelName: null,
    //             options: null,
    //             placeholder: '请填写',
    //             length: { maxLength: 200, minLength: 0 },
    //             pattern: null,
    //             disabled: false,
    //             required: true,
    //             checkTexts: {
    //                 isEmptyText: '请填写标签名称', patternText: 'XX输入错误', otherText: null
    //             },
    //             icon: null,
    //             layout: {
    //                 lg: 12, md: 12, sm: 24
    //             }
    //         }, {
    //             lookupCode: '需要映射的字段',
    //             title: '单选',
    //             subTitle: null,
    //             inputType: 'radio',
    //             modelName: null,
    //             options: [{ lookupValue: '男', lookupCode: 1 }, { lookupValue: '女', lookupCode: 0 }],
    //             placeholder: null,
    //             length: { maxLength: null, minLength: null },
    //             pattern: null,
    //             disabled: false,
    //             required: true,
    //             checkTexts: {
    //                 isEmptyText: '请选择', patternText: null, otherText: null
    //             },
    //             icon: null,
    //             layout: {
    //                 lg: 12, md: 12, sm: 24
    //             }
    //         }, {
    //             lookupCode: '需要映射的字段',
    //             title: '多选',
    //             subTitle: null,
    //             inputType: 'checkbox',
    //             modelName: null,
    //             options: [{ lookupValue: '男', lookupCode: 1 }, { lookupValue: '女', lookupCode: 0 }],
    //             placeholder: null,
    //             length: { maxLength: null, minLength: null },
    //             pattern: null,
    //             disabled: false,
    //             required: true,
    //             checkTexts: {
    //                 isEmptyText: '请选择', patternText: null, otherText: null
    //             },
    //             icon: null,
    //             layout: {
    //                 lg: 12, md: 12, sm: 24
    //             }
    //         }, {
    //             lookupCode: '需要映射的字段',
    //             title: '单选弹出',
    //             subTitle: null,
    //             inputType: 'select',
    //             modelName: null,
    //             options: [{ lookupValue: '男', lookupCode: 1 }, { lookupValue: '女', lookupCode: 0 }],
    //             placeholder: '请选择',
    //             length: { maxLength: null, minLength: null },
    //             pattern: null,
    //             disabled: false,
    //             required: true,
    //             checkTexts: {
    //                 isEmptyText: '请选择XX', patternText: null, otherText: null
    //             },
    //             icon: null,
    //             layout: {
    //                 lg: 12, md: 12, sm: 24
    //             }
    //         }, {
    //             lookupCode: '需要映射的字段',
    //             title: '多选弹出',
    //             subTitle: null,
    //             inputType: 'select-tag',
    //             modelName: null,
    //             options: null,
    //             placeholder: '请选择',
    //             length: { maxLength: 5, minLength: 1 },
    //             pattern: null,
    //             disabled: false,
    //             required: true,
    //             checkTexts: {
    //                 isEmptyText: '请选择XX', patternText: '', otherText: null
    //             },
    //             icon: null,
    //             layout: {
    //                 lg: 12, md: 12, sm: 24
    //             }
    //         }, {
    //             lookupCode: '需要映射的字段',
    //             title: '日期',
    //             subTitle: null,
    //             inputType: 'date',
    //             modelName: 1551938189000,
    //             options: null,
    //             placeholder: null,
    //             length: { maxLength: 1551938189000, minLength: 1551938189001 },
    //             pattern: null,
    //             disabled: true,
    //             required: true,
    //             checkTexts: {
    //                 isEmptyText: '请选择XX', patternText: null, otherText: null
    //             },
    //             icon: null,
    //             layout: {
    //                 lg: 12, md: 12, sm: 24
    //             }
    //         }, {
    //             lookupCode: '需要映射的字段',
    //             title: '时间',
    //             subTitle: null,
    //             inputType: 'datetime',
    //             modelName: null,
    //             options: null,
    //             placeholder: '请选择',
    //             length: { maxLength: 1551938189000, minLength: 1551938189001 },
    //             pattern: null,
    //             disabled: true,
    //             required: true,
    //             checkTexts: {
    //                 isEmptyText: '请选择XX', patternText: null, otherText: null
    //             },
    //             icon: null,
    //             layout: {
    //                 lg: 12, md: 12, sm: 24
    //             }
    //         }, {
    //             lookupCode: '需要映射的字段',
    //             title: '图片',
    //             subTitle: null,
    //             inputType: 'image',
    //             modelName: null,
    //             options: null,
    //             placeholder: '请选择',
    //             length: { maxLength: 9, minLength: 0 },
    //             pattern: null,
    //             disabled: false,
    //             required: true,
    //             checkTexts: {
    //                 isEmptyText: '请选择XX', patternText: null, otherText: null
    //             },
    //             icon: null,
    //             layout: {
    //                 lg: 12, md: 12, sm: 24
    //             }
    //         }], iconUrlGroups: null, skipGroups: null, buttonGroups: null
    //     }], iconUrlGroups: null, skipGroups: null, buttonGroups: null
    // }];
}



